package com.sinothk.special.buyer.popular.user.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sinothk.special.buyer.popular.user.entity.PopularBlogDTO;
import com.sinothk.special.buyer.popular.user.entity.PopularUser;
import com.sinothk.special.buyer.popular.user.entity.PopularUserDTO;
import com.sinothk.special.buyer.popular.user.entity.PopularUserSearchVO;
import com.sinothk.special.buyer.popular.user.service.IPopularUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 热门个人推荐
 * @Author: Liangyt
 * @Date: 2022-06-17
 * @Version: V1.0
 */
@Api(tags = "热门个人推荐")
@RestController
@RequestMapping("/popular/popularUser")
@Slf4j
public class PopularUserController extends JeecgController<PopularUser, IPopularUserService> {

    @Autowired
    private IPopularUserService popularUserService;

    /**
     * 热门个人推荐-分页列表查询
     *
     * @param pageNo
     * @param pageSize
     * @return
     */
    @AutoLog(value = "热门个人推荐-分页列表查询")
    @ApiOperation(value = "热门个人推荐-分页列表查询", notes = "热门个人推荐-分页列表查询")
    @GetMapping(value = "/popularUserPage")
    public Result<IPage<PopularUserDTO>> popularUserPage(
            PopularUserSearchVO searchVO,
            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return Result.OK(popularUserService.popularUserPage(new Page<>(pageNo, pageSize), searchVO));
    }


    /**
     * 热门博客推荐-分页列表查询
     *
     * @param pageNo
     * @param pageSize
     * @return
     */
    @AutoLog(value = "热门博客推荐-分页列表查询")
    @ApiOperation(value = "热门博客推荐-分页列表查询", notes = "热门博客推荐-分页列表查询")
    @GetMapping(value = "/popularBlogPage")
    public Result<IPage<PopularBlogDTO>> popularBlogPage(
            PopularUserSearchVO searchVO,
            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return Result.OK(popularUserService.popularBlogPage(new Page<>(pageNo, pageSize), searchVO));
    }
}
